package com.example.common.Retrofit;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitHelper {
    private Retrofit retrofit;
    private OkHttpClient client;
    public RetrofitHelper(){

    }

    public Retrofit getRetrofit(){
        this.client= new OkHttpClient.Builder()
                .addInterceptor(new AddCookiesInterceptor()) //这部分
                .build();

        this.retrofit=new Retrofit.Builder()
                .baseUrl("http://106.14.59.33")
                .client(client)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        return retrofit;
    }

    public Retrofit getFirstRetrofit() {
        this.client= new OkHttpClient.Builder()
                .addInterceptor(new ReceivedCookiesInterceptor()) //这部分
                .build();

        this.retrofit=new Retrofit.Builder()
                .baseUrl("http://106.14.59.33")
                .client(client)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        return retrofit;
    }
}
